---
title: "Sentry"
description: "The `withSentry()` plugin for hot-updater enables automatic sourcemap upload to Sentry during the update bundle build process."
icon: sentry
---

import { Tabs, Tab } from 'fumadocs-ui/components/tabs';

## Prerequisites

- Sentry Account: Sign up here if you don't have one.
- Auth Token: Generate a token with the project:releases and org:read scopes from your Sentry dashboard.
- Install the plugin:

```package-install
npm install @hot-updater/sentry-plugin --save-dev
```

## Step 1: Configure Sentry

<Tabs items={['Metro', 'Re.Pack']}>
  <Tab value="Metro">
    

    You need to configure Metro. Please refer to the [Sentry documentation](https://docs.sentry.io/platforms/react-native/manual-setup/metro/) above for detailed setup instructions.

    ```js title="metro.config.js"
    const { getDefaultConfig } = require("@react-native/metro-config");
    const { withSentryConfig } = require("@sentry/react-native/metro");

    const config = getDefaultConfig(__dirname);
    module.exports = withSentryConfig(config);
    ```
  </Tab>
  <Tab value="Re.Pack">

  You need to configure Re.Pack.

```package-install
repack-plugin-sentry
```

```js title="rspack.config.mjs"
import { SentryDebugIdPlugin } from "repack-plugin-sentry";

export default {
  // ... your other config
  plugins: [
    // ... your other plugins
    new SentryDebugIdPlugin(), // [!code ++]
  ],
};
```
  </Tab>
</Tabs>



## Step 2: Wrap Your Build Plugin

Use `withSentry()` to wrap any compatible build plugin such as bare.

Once wrapped, sourcemaps will automatically be uploaded to Sentry when running the `hot-updater deploy` process.

<Tabs items={['Bare', 'Expo', 'Rock']}>
  <Tab value="Bare">

```ts title="hot-updater.config.ts"
import { bare } from "@hot-updater/bare";
import { withSentry } from "@hot-updater/sentry-plugin";
import { defineConfig } from "hot-updater";
import { config } from "dotenv";

config({ path: ".env.hotupdater" });

export default defineConfig({
  build: withSentry(
    bare({
      enableHermes: false,
      sourcemap: true, // [!code ++] Required for sourcemap upload
    }),
    {
      org: "your-org-slug",       // [!code ++] Your Sentry organization slug
      project: "your-project",    // [!code ++] Your Sentry project slug
      authToken: process.env.SENTRY_AUTH_TOKEN!, // [!code ++]
    },
  ),
  // .. your other config
});
```
</Tab>
<Tab value="Expo">

```ts title="hot-updater.config.ts"
import { withSentry } from "@hot-updater/sentry-plugin";
import { defineConfig } from "hot-updater";
import { expo } from "@hot-updater/expo";

export default defineConfig({
  build: withSentry(
    expo({
      sourcemap: true, // [!code ++] Required for sourcemap upload
    }),
    {
      org: "your-org-slug",       // [!code ++] Your Sentry organization slug
      project: "your-project",    // [!code ++] Your Sentry project slug
      authToken: process.env.SENTRY_AUTH_TOKEN!, // [!code ++]
    },
  ),
  // .. your other config
});
```
</Tab>

<Tab value="Rock">

```ts title="hot-updater.config.ts"
import { withSentry } from "@hot-updater/sentry-plugin";
import { defineConfig } from "hot-updater";
import { rock } from "@hot-updater/rock";

export default defineConfig({
  build: withSentry(
    rock({
      sourcemap: true, // [!code ++] Required for sourcemap upload
    }),
    {
      org: "your-org-slug",       // [!code ++] Your Sentry organization slug
      project: "your-project",    // [!code ++] Your Sentry project slug
      authToken: process.env.SENTRY_AUTH_TOKEN!, // [!code ++]
    },
  ),
  // .. your other config
});
```

</Tab>

</Tabs>

<Callout title="Automatic Upload">
When `withSentry()` wraps your build plugin, all generated sourcemaps are uploaded to Sentry automatically during the `hot-updater deploy` process.
</Callout>

## Step 3: Deploy

Now, every time you deploy, sourcemaps will be automatically uploaded to Sentry.

```package-install
npx hot-updater deploy -i
```
